#include <bits/stdc++.h>
using ll=long long; 
using namespace std;

const int MOD = 1e9 + 7;

ll pow_mod(ll base, ll exp, ll mod) {
    ll result = 1;
    base %= mod;
    while (exp > 0) {
        if (exp % 2 == 1) {
            result = (result * base) % mod;
        }
        base = (base * base) % mod;
        exp /= 2;
    }
    return result;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    ll ans = 1;
    for (int k = 0; k < 32; ++k) {
        int cnt1 = 0;
        for (int num : A) {
            if (num & (1 << k)) {
                cnt1++;
            }
        }
        int cnt0 = N - cnt1;
        ll total = (ll)cnt1 * cnt0;
        ll con = pow_mod(2, k * total, MOD);
        ans = (ans * con) % MOD;
    }

    cout << ans << endl;

    return 0;
}
